package com.wjw.java.oop.polymorphic_.demo;

/**
 * 父类：Food
 * 子类：Bone、Fish
 */
public class Food {
    String name;

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Food(String name) {
        this.name = name;
    }
}
//肉骨头：子类
class Bone extends Food {
    public Bone(String name) {
        super(name);
    }
}
//鱼：子类
class Fish extends Food {
    public Fish(String name) {
        super(name);
    }
}
